const {
  Sequelize,
  Model
} = require('sequelize')
const {
  sequelize
} = require('../config/db');

// 定义模型
class artical extends Model {

}

artical.init({
  id: {
    type: Sequelize.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  title: {
    type: Sequelize.STRING,
    allowNull: false,
    comment: '标题'
  },
  coverImage:{
    type: Sequelize.STRING,
    allowNull: true,
    comment: '封面图片'
  },
  author: {
    type: Sequelize.STRING,
    allowNull: true,
    comment: '作者'
  },
  content:{
    type: Sequelize.TEXT('long'),
    allowNull: true,
    comment: '内容'
  },
  status:{
    type: Sequelize.STRING,
    allowNull: true,
    comment: '状态'
  },
  pv:{
    type: Sequelize.INTEGER,
    allowNull: true,
    comment: '浏览量'
  },
}, {
  sequelize,
  modelName: 'artical',
  tableName: 'artical'
})

// artical.sync({
//   force: true
// })

module.exports = artical